package mysql

import "gorm.io/gorm"

type Order struct {
	gorm.Model
	UserId      int64   `gorm:"type:int(11);comment:用户id"`
	OrderSn     string  `gorm:"type:char(36);not null;comment:订单号"`
	PayType     int64   `gorm:"type:tinyint(1);comment:支付类型:1:支付宝,2:微信"`
	Amount      float64 `gorm:"type:decimal(10,2);comment:金额"`
	OrderStatus int64   `gorm:"type:tinyint(1);default:1;comment:状态:1:待支付,2:已支付,3:已取消,4:已退款,5:已完成"`
}

type HouseOrder struct {
	gorm.Model
	OrderId       int64  `gorm:"type:int(11);comment:订单id"`
	HouseId       int64  `gorm:"type:int(11);comment:房源id"`
	HouseCity     string `gorm:"type:varchar(20);comment:房源城市"`
	Address       string `gorm:"type:varchar(50);comment:小区地址"`
	HouseBuild    string `gorm:"type:varchar(3);comment:楼栋号"`
	HouseFloor    string `gorm:"type:varchar(3);comment:楼层"`
	HouseArea     int64  `gorm:"type:int(11);comment:房屋面积"`
	HouseDescribe string `gorm:"type:varchar(100);comment:房源描述"`
	HouseCover    string `gorm:"type:varchar(300);comment:房源封面"`
}

func (o *Order) Create() error {
	return Db.Create(&o).Error
}

func (ho *HouseOrder) Create() error {
	return Db.Create(&ho).Error
}
